package chat02;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lenovo
 * Date: 2024-09-12
 * Time: 20:19
 */
public class Server {

    public static List<Socket> list = new ArrayList<Socket>();

    public static void main(String[] args) throws Exception {
        // 创建一个服务器
        ServerSocket server = new ServerSocket(8888);

        System.out.println("服务器创建成功==>等待客户端连接......");

        // 等待客户端连接
        Socket socket = null;
        while((socket = server.accept())!=null){
            Server.list.add(socket);
            System.out.println(Server.list.size());
            new ServerThread(socket).start();

        }



    }

}

